Engineers use compression (also called source coding or source encoding) to reduce the bit rate of digital media data. Compression decreases the cost of storing and transmitting media data by converting the media data into a lower bit rate form. Decompression (also called decoding) reconstructs a version of the original media data from the compressed form. A “codec” is an encoder/decoder system. Over the last two decades, various video codec standards and formats have been adopted, and various audio codec standards and formats have been adopted. A codec standard or format typically defines options for the syntax of an encoded media bit stream (sometimes called a media elementary bit stream), detailing parameters in the media elementary bit stream when particular features are used in encoding and decoding. In many cases, a codec standard or format also provides details about the decoding operations a media decoder should perform to achieve correct results in decoding.
A media container format or streaming media format specifies how to organize encoded media data for storage, transmission, etc. A media container format or streaming media format can include fields for metadata about the encoded media data, such as timestamps used to regulate the timing of decoding or presentation, digital rights management data, playback control data or other data indicating how to decode or render the media data. Various media container formats have been promulgated for media data, including MPEG-2 TS/PS as defined in ITU-T H.222.0|ISO/IEC 13818-1, Advanced Systems Format (“ASF”) (formerly Advanced Streaming Format), MPEG-4 (“MP4”) as defined in ISO/IEC 14496-12 (ISO base media file format), 14496-14 (MP4 file format) and 14496-15 (AVC file format), Common File Format (“CFF”) and Matroska Video Format (“MKV”). Various streaming media formats have also been promulgated for media data, including MPEG-DASH, HTTP Live Streaming (“HLS”), Smooth Streaming and variations of Real-time Transport Protocol (“RTP”) (e.g., as defined in IETF RFC 3550 or another IETF RTP specification), which may include encoded media data in a container format file (such as MP4 or MPEG-2 TS) or in one or more media elementary bit streams. In general, a media source is a component that parses a media file or media stream, and provides encoded media data in a media elementary bit stream to a media decoder for decoding.
Every day, millions of media files and media streams are consumed by users through assorted activities. In some cases, a media file or media stream is corrupted due to random bit flips or packet loss during transmission. Or, a media file or media stream may be corrupted due to a storage failure, due to improper recording or for another reason. When media data in the media file or media stream is played back, a media decoder may drop a media sample (e.g., video frame) that cannot be decoded. Sample metadata associated with the media data may then lose synchronization relative to the media samples being decoded. This loss of metadata-media synchronization can cause problems with decoding or presentation, such as loss of audio/video synchronization or errors in reordering of media samples, which may depend on complicated reordering rules. Also, media files and media streams may be produced by diverse sources. Matching sample metadata to media samples can be challenging. Mistakes in mapping sample metadata to appropriate media samples can cause problems with media decoding, media presentation or media editing.